package wyj;

import java.util.Scanner;

class Main5 {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int m=in.nextInt();
        int sum=0;
        int i=2;
        int z;
        int y;
        y=2;
        while(n<=m&m<=200&n>0){
            if (n==1){
                i=2;
                n++;
                sum=sum+i;
            }
            else{
                i=3+2*(y-2);
                if(isPrime(i)){
                    sum=sum+i;
                    n++;
                    y++;
                }
                else{
                  y=y+1;
                }
            }

        }
        System.out.println(sum);


    }
     private static boolean isPrime(int i) {
         boolean flag = true;
         for (int j = 2; j < i; j++){
             if (i%j==0){
                 flag=false;
             }
         }
         return flag;
     }


}


